<template>
	<view class="container pt_8">
		
		
		<view class="ptb_8 plr_16 fx jcb" v-for="item,index in formdata" :key="index">
			
			<template>
				<view class="fx_1 flow_h">
					<view class="fe">
						{{item.prizeName}}
					</view>
					<view class="fc_999 mt_4">
						{{ item.createTime }}
					</view>
				</view>
				
				<view >
					<view style="color: red;" class="fe pl_8 " @click="orderidView(item)" v-if="item.orderId!=null&&item.type==2">
						查看订单>
					</view>
					<view style="color: red;"	@click="orderidnull(item)" class="fe pl_8" v-if="item.orderId==null&&item.type==2">
						完善领取信息>
					</view>
					<view style="float: right;" class="fc_333 pl_8">
						-{{item.integral}}
					</view>
				</view>
			</template>
		</view>
	</view>
</template>

<script>

	import api from '@/service/config/api'
	export default {
		
		data() {
			return {
				formdata:[]
			}
		},
		
		onLoad(options) {
			this.getData()
		},
		methods: {
			orderidView(e){
				console.log(e)
				uni.navigateTo({
					url: '/pages/person/pages/order_detail?id=' + e.orderId
				})
			},
			orderidnull(e){
				api.post('/order/api/order/preOrder', {
					preOrderType: 7,
					productDetails: [{
						buyNum: 1,
						brandId: e.productInfo.brandId,//品牌ID
						productId: e.productInfo.id,//商品ID
						bigWheelLotteryRecordId: e.id//	中奖记录id
					}]
				}).then(res => {
					uni.navigateTo({
						url: '/pages/goods/pages/confirm?order=' + res.data.preOrderNo + '&preOrderTypeid=' + 7 +
							'&content=' + e.content
					})
				})
			},
			getData() {
				let list = {
					size: 10,
					current: 1,
				}
				
				api.get('/goods/bigWheel/getUserBigWheelLotteryRecordList', list, ).then(res => {
				
					this.formdata=res.data.records
					console.log(res.data.records)
					
				}).finally(() => {
				
				})
			},
			
			
		},
	}
</script>

<style lang="scss">
	.container {}
</style>